{% set pypi_name = 'reno' %}
{% set upstream_version = upstream_version('3.2.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        RElease NOtes manager
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('docutils') }}
BuildRequires:  {{ py3('dulwich') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testscenarios') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  git-core
BuildRequires:  gpg2
%else
BuildRequires:  git
BuildRequires:  gnupg
%endif

%description
Reno is a release notes manager for storing release notes in a git
repository and then building documentation from them.

%package -n {{ py2name(py_versions='py3') }}
Summary:        RElease NOtes manager
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('Sphinx') }}
Requires:       {{ py3('docutils') }}
Requires:       {{ py3('dulwich') }}
Requires:       {{ py3('pbr') }}
Requires:       {{ py3('six') }}

%description -n {{ py2name(py_versions='py3') }}
Reno is a release notes manager for storing release notes in a git
repository and then building documentation from them.

%prep
%autosetup -p1 -n {{ pypi_name}}-{{ upstream_version }}
# we don't need hacking
sed -i '/^hacking.*/d' test-requirements.txt
%py_req_cleanup

%build
%{py3_build}

%install
%{py3_install}

%check
rm -rf .git
git init .
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%{_bindir}/reno
%{python3_sitelib}/reno
%{python3_sitelib}/*.egg-info

%changelog
